﻿using System;
using System.Collections.Generic;
using STeaL.Functional;

namespace STeaL.Algorithm {
  public static partial class IListExtensions {
#region fill
    public static void fill<T>(this IList<T> list, int first, int last, T val) {
      for (; first != last; ++first ) list[first] = val;
    }

    public static void fill<T>(this IList<T> list, T val) {
      fill(list, 0, list.Count, val);
    }

#endregion
#region fill_n
    public static void fill_n<T>(this IList<T> list, int first, int count, T val) {
      for ( ; 0 < count--; ++first ) list[first] = val;
    }

    public static void fill_n<T>(this IList<T> list, T val) {
      fill_n(list, 0, list.Count, val);
    }

#endregion
  }
}
